package com.hqyj.web;

import com.hqyj.util.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//如果你登录了，那么想访问什么资源都可以，如果没登录，403， 不能访问资源
@RestController
public class LoginController {

    @RequestMapping("login")
    public String login(String uname, String upwd) throws Exception {
        String  token = "";
        if(uname != null && upwd != null){
             token = TokenUtil.sign(uname);
        }
        return  token;
    }
}
